<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/inc/taglib.inc" %>
<%@ include file="/WEB-INF/inc/script.inc" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<base href="${base}">
    <title>中金通 | 权限列表</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="font-awesome/css/font-awesome.css" rel="stylesheet">

	<!-- Data Tables -->
    <link href="css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="css/plugins/dataTables/dataTables.responsive.css" rel="stylesheet">
<!--     <link href="css/plugins/dataTables/dataTables.tableTools.min.css" rel="stylesheet"> -->

    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link href="css/plugins/jsTree/style.min.css" rel="stylesheet">

</head>
<body>
    <div id="wrapper">
    	<!-- 左侧菜单 -->
        <jsp:include page="/WEB-INF/jsp/common/main-menu.jsp"></jsp:include>

        <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
        <!-- 头部工具栏区 -->
        <jsp:include page="/WEB-INF/jsp/common/main-header.jsp"></jsp:include>
        </div>
            <div class="row wrapper border-bottom white-bg page-heading">
                <div class="col-lg-10">
                    <h2>权限管理</h2>
                    <ol class="breadcrumb">
                        <li>
                            <a href="common/platform">Home</a>
                        </li>
                        <li>
                            <a href="authorities/list">权限管理</a>
                        </li>
                        <li class="active">
                            <strong>权限列表</strong>
                        </li>
                    </ol>
                </div>
                <div class="col-lg-2">

                </div>
            </div>
		
		<div class="row" style="margin-top:10px;">
			<div class="col-md-12">
                    <div class="tabs-container">
                        <ul class="nav nav-tabs">
                            <li class="active">
								<a href="authorities/list">
									 权限列表
								</a>
							</li>
							<li>
								<a href="authorities/add">
									 新增权限
								</a>
							</li>
                        </ul>
                        <div class="tab-content">
                            <div class="tab-pane active">
                                <div class="panel-body">
                                    <div class="wrapper wrapper-content animated fadeInRight ecommerce">

            <div class="ibox-content m-b-sm"><!-- border-bottom -->
                <form id="queryForm" method="post">
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="control-label" for="authName">权限名称</label>
                            <input type="text" id="authName" name="authName" value="" class="form-control">
                        </div>
                    </div>
<!--                     <div class="col-sm-4"> -->
<!--                         <div class="form-group"> -->
<!--                             <label class="control-label" for="authDesc">权限中文名</label> -->
<!--                             <input type="text" id="authDesc" name="authDesc" value="" class="form-control"> -->
<!--                         </div> -->
<!--                     </div> -->
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="control-label" for="moduleId">所属菜单</label>
                            <select class="form-control m-b" id="moduleId" name="moduleId">
                                <option value="">请选择...</option>
								<c:forEach items="${menuList}" var="menu" varStatus="st">
									<option value="${menu.moduleId}">${menu.moduleName}</option>
								</c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="control-label" for="enabled">是否激活</label>
                            <select class="form-control m-b" id="enabled" name="enabled">
								<option value="">请选择...</option>
								<option value="1">是</option>
								<option value="0">否</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row">
                    
                    
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="control-label" for="showMenu">显式权限</label>
                            <select class="form-control m-b" id="showMenu" name="showMenu">
								<option value="">请选择...</option>
								<option value="true">是</option>
								<option value="false">否</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row">
                	<div class="form-group">
                         <div class="col-sm-4 col-sm-offset-5">
                             <button class="btn btn-primary" id="queryBtn" type="button">查 询</button>
                             <button class="btn btn-white" type="reset">重 置</button>
                         </div>
                    </div>
                </div>
				</form>
            </div>

            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content">
                            <table id="modelEditable" class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>权限名称</th>
<!--                                     <th>权限中文名</th> -->
                                    <th>所属菜单</th>
                                    <th>显式权限</th>
                                    <th>默认动作</th>
                                    <th>显示顺序</th>
                                    <th>是否激活</th>
                                    <th style="background-color:white;">操作</th>
                                </tr>
                                </thead>
                                <tbody>

                                </tbody>
                            </table>

                        </div>
                    </div>
                </div>
            </div>
            <!-- update model start -->
				<div class="modal inmodal fade" id="updateModel" tabindex="-1" role="dialog"  aria-hidden="true">
                                <div class="modal-dialog modal-lg">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                            <h4 class="modal-title">权限修改</h4>
                                        </div>
                                        <div class="modal-body">
                                        <div id="updateBody"></div>
										<script id="updateTemplate" type="text/x-jquery-tmpl">
                               <form method="post" id="updateModelForm" class="form-horizontal">
								<input type="hidden" value="0" id="rootLoad"/>
								<input type="hidden" value="{{= authId}}" id="authId" name="authId"/>
                                <div class="form-group"><label class="col-sm-2 control-label">权限名</label>
                                    <div class="col-sm-8"><input type="text" name="authName" value="{{= authName}}" class="form-control"></div>
                                </div>
                                <!--
                                <div class="form-group"><label class="col-sm-2 control-label">权限中文名</label>
                                    <div class="col-sm-8"><input type="text" name="authDesc" value="{{= authDesc}}" class="form-control">
                                    </div>
                                </div>-->
								<div class="form-group"><label class="col-sm-2 control-label">所属菜单</label>
                                    <div class="col-sm-8"><select class="form-control m-b" id="updateModuleId" name="moduleId">
										{{each(i,menu) menuList}}
											<option value="{{= menu.moduleId}}" {{if menu.moduleId == $data.moduleId}}selected{{/if}}>{{= menu.moduleName}}</option>
										{{/each}}
                                    </select>
                                    </div>
                                </div>
								<div class="form-group"><label class="col-sm-2 control-label">显式权限</label>
                                    <div class="col-sm-8"><select id="showMenu" class="form-control m-b" name="showMenu">
										<option value="true" {{if showMenu == true}}selected{{/if}}>是</option>
										<option value="false" {{if showMenu == false}}selected{{/if}}>否</option>
                                    </select>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">默认动作</label>
                                    <div class="col-sm-8"><input type="text" id="action" name="action" value="{{= action}}" placeholder="/user/login" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">显示顺序</label>

                                    <div class="col-sm-8"><input type="text" name="orders" value="{{= orders}}" class="form-control"></div>
                                </div>
                                
                                <div class="form-group"><label class="col-sm-2 control-label">是否激活</label>
                                    <div class="col-sm-8"><select class="form-control m-b" name="enabled">
										<option value="1" {{if enabled == 1}}selected{{/if}}>是</option>
										<option value="0" {{if enabled == 0}}selected{{/if}}>否</option>
                                    </select>
                                    </div>
                                </div>
                                
                                <div class="form-group"><label class="col-sm-2 control-label">权限资源</label>
                                    <div class="col-sm-8">
                                    <div id="resourceTree" class="tree-demo">
									</div>
									<input type="hidden" id="urls" name="urls"/>
                                    </div>
                                </div>
                            </form>
										</script>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-white" data-dismiss="modal">取 消</button>
                                            <button type="button" id="saveModel" class="btn btn-primary">保 存</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- update model end -->
        </div>
                                </div>
                            </div>
                            
                        </div>
                    </div>
                </div>
		</div>
		
        <!-- 底部版权 -->
        <jsp:include page="/WEB-INF/jsp/common/main-footer.jsp"></jsp:include>

        </div>
        </div>

    <!-- Mainly scripts -->
    <script src="js/jquery-2.1.1.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script src="js/plugins/jeditable/jquery.jeditable.js"></script>
	<script src="js/jquery.serialize-object.min.js" type="text/javascript"></script>
    <!-- Custom and plugin javascript -->
    <script src="js/inspinia.js"></script>
    <script src="js/plugins/pace/pace.min.js"></script>
	<script src="js/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
	<script src="js/jquery.tmpl.min.js" type="text/javascript"></script>

    <!-- Data Tables -->
    <script src="js/plugins/dataTables/jquery.dataTables.min.js"></script>
    <script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>
    <script src="js/plugins/dataTables/dataTables.responsive.js"></script>
<!--     <script src="js/plugins/dataTables/dataTables.tableTools.min.js"></script> -->
    
    <!-- 业务 -->
    <script src="js/plugins/jsTree/jstree.min.js"></script>
    <script src="js/authorities/auth-module.js"></script>

    <!-- Page-Level Scripts -->
    <script>
        $(document).ready(function() {
			AuthModule.init();
        });

    </script>

</body>
</html>